/* import request from './request.js'; */
import fetch from "./request.js";

// 查询当前帐号信息
export function queryCurrentAccount(data) {
  return fetch("/nb-app/1.0.1/LoginService/queryCurrentAccount", {
    method: "post",
    data: data,
    withLoading: true,
  });
}

// 查询全量菜单树
export function queryAllPageTree(data) {
  return fetch("/nb-as/1.0.1/PageService/queryAllPageTree", {
    method: "post",
    data: data,
  });
}

// 所属品类
export function queryProduceCategoryTree(data) {
  return fetch(
    "/nb-app/1.0.1/ProduceCategoryService/queryProduceCategoryTree",
    {
      method: "post",
      data: data,
      withLoading: true,
    }
  );
}

// 字典
export function queryDictDataTree(data) {
  return fetch("/nb-as/1.0.1/DictService/queryDictDataTree", {
    method: "post",
    data: data,
  });
}

// 区域字典
export function queryRegionTree(data) {
  return fetch("/nb-as/1.0.1/RegionService/queryRegionTree", {
    method: "post",
    data: data,
  });
}

// 预览
export function previewFile(data) {
  return fetch(`/nb-as/1.0.1/FileService/previewFile?fileId=${data}`, {
    method: "post",
    data: data,
    withLoading: true,
  });
}
// 上传
export function uploadFile(data) {
  return fetch(`/nb-as/1.0.1/FileService/uploadFile`, {
    method: "post",
    data: data,
    withLoading: true,
  });
}
// 下载电子表格
export function downloadExcelTemplate(data) {
  return fetch("/nb-as/1.0.1/TemplateService/downloadExcelTemplate", {
    method: "post",
    data: data,
    headers:{
      "Content-Type":"application/json; charset=utf-8"
    },
    responseType: "blob",
    noInterceptors: true, //配置下载不走拦截器
    withLoading: true,
  });
}
